<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <title>添加套餐</title>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
  
    <link rel="stylesheet" href="/pc/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/font_eolqem241z66flxr.css" media="all" />
</head>
<body class="childrenBody">
      <form class="layui-form">
     {{ csrf_field() }}
        <div class="layui-form-item">
            <label class="layui-form-label">套餐名</label>
                <div class="layui-input-block" style="width: 25em;">
                 <input type ="text" name="" key=""  id="tcm" class="layui-input" placeholder="">
                </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label">套餐内容</label>
             <div class="layui-input-block" style="width: 25em;">
               <input type ="text" name="loc" id="tcn" class="layui-input" placeholder="">
            </div>
        </div>   
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="addSetmeal">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

</body>
  <script type="text/javascript" src="/pc/layout/js/jquery.min.js"></script>
    <script type="text/javascript" src="/pc/layui/layui.js"></script>
<script type="text/javascript">
     layui.config({
        base : "js/"
    }).use(['form','layer','jquery','laypage','element','laydate'],function(){
        var laydate = layui.laydate;
        var element = layui.element();
        var form = layui.form(),
            layer = parent.layer === undefined ? layui.layer : parent.layer,
            laypage = layui.laypage,
            $ = layui.jquery;

    form.on('submit(addSetmeal)',function(data){
        console.log($('#tcm').val())
        var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
        $.ajax({
            type:'post',
            url:'/admin/setmeal/store',
            async:false,
            data:{
                '_token':$('input[name=_token]').val(),
                'taocanming':$('#tcm').val(),
                'taocanneirong':$('#tcn').val()   
            },
            dataType:'json',
            success:function (data) {
                if(data.status == 1){
                    top.layer.close(index);
                    top.layer.msg("套餐添加成功！");
                    layer.closeAll("iframe");
                    //刷新父页面
                    parent.location.reload();
                }else{
                    top.layer.close(index);
                    top.layer.msg("套餐添加失败！");
                }
            }
        })
        return false;
    })
    })




</script>
</html>